home *** CD-ROM | disk | FTP | other *** search
/ Programming a Multiplayer FPS in DirectX / Programming a Multiplayer FPS in DirectX (Companion CD).iso / DirectX / dxsdk_oct2004.exe / dxsdk.exe / Samples / C++ / Direct3D / DXTex / dxtexview.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-09-27  |  4.9 KB  |  130 lines

  1. // dxtexView.h : interface of the CDxtexView class
  2. //
  3. /////////////////////////////////////////////////////////////////////////////
  4.  
  5. #if !defined(AFX_DXTXVIEW_H__712C53D1_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_)
  6. #define AFX_DXTXVIEW_H__712C53D1_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_
  7.  
  8. #if _MSC_VER > 1000
  9. #pragma once
  10. #endif // _MSC_VER > 1000
  11.  
  12.  
  13. class CDxtexView : public CScrollView
  14. {
  15. protected: // create from serialization only
  16.     CDxtexView();
  17.     DECLARE_DYNCREATE(CDxtexView)
  18.     CDxtexDoc* GetDocument();
  19.  
  20. // Operations
  21. public:
  22.  
  23. // Overrides
  24.     // ClassWizard generated virtual function overrides
  25.     //{{AFX_VIRTUAL(CDxtexView)
  26.     public:
  27.     virtual void OnDraw(CDC* pDC);  // overridden to draw this view
  28.     virtual void OnInitialUpdate();
  29.     protected:
  30.     virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
  31.     //}}AFX_VIRTUAL
  32.  
  33. // Implementation
  34. public:
  35.     virtual ~CDxtexView();
  36. #ifdef _DEBUG
  37.     virtual void AssertValid() const;
  38.     virtual void Dump(CDumpContext& dc) const;
  39. #endif
  40.     BOOL TitleModsChanged(VOID) { return m_bTitleModsChanged; }
  41.     VOID ClearTitleModsChanged(VOID) { m_bTitleModsChanged = FALSE; }
  42.     CString GetStrTitleMods(VOID);
  43.     VOID GetImageInfo(CString& strInfo);
  44.     HRESULT InvalidateDeviceObjects(VOID);
  45.     HRESULT RestoreDeviceObjects(VOID);
  46.  
  47. // Generated message map functions
  48. protected:
  49.     //{{AFX_MSG(CDxtexView)
  50.     afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  51.     afx_msg void OnFileOpenSubsurface();
  52.     afx_msg void OnFileOpenAlphaSubsurface();
  53.     afx_msg void OnFileOpenFace();
  54.     afx_msg void OnFileOpenAlphaFace();
  55.     afx_msg void OnViewOriginal();
  56.     afx_msg void OnViewCompressed();
  57.     afx_msg void OnViewAlphaChannel();
  58.     afx_msg void OnViewLargerMipLevel();
  59.     afx_msg void OnViewSmallerMipLevel();
  60.     afx_msg void OnViewZoomIn();
  61.     afx_msg void OnViewZoomOut();
  62.     afx_msg void OnViewChangeBackgroundColor();
  63.     afx_msg void OnViewNegX();
  64.     afx_msg void OnViewPosX();
  65.     afx_msg void OnViewNegY();
  66.     afx_msg void OnViewPosY();
  67.     afx_msg void OnViewNegZ();
  68.     afx_msg void OnViewPosZ();
  69.     afx_msg void OnViewHigherVolumeSlice();
  70.     afx_msg void OnViewLowerVolumeSlice();
  71.     afx_msg void OnUpdateFileOpenSubsurface(CCmdUI* pCmdUI);
  72.     afx_msg void OnUpdateFileOpenAlphaSubsurface(CCmdUI* pCmdUI);
  73.     afx_msg void OnUpdateFileOpenFace(CCmdUI* pCmdUI);
  74.     afx_msg void OnUpdateFileOpenAlphaFace(CCmdUI* pCmdUI);
  75.     afx_msg void OnUpdateViewOriginal(CCmdUI* pCmdUI);
  76.     afx_msg void OnUpdateViewCompressed(CCmdUI* pCmdUI);
  77.     afx_msg void OnUpdateViewAlphaChannel(CCmdUI* pCmdUI);
  78.     afx_msg void OnUpdateViewLargerMipLevel(CCmdUI* pCmdUI);
  79.     afx_msg void OnUpdateViewSmallerMipLevel(CCmdUI* pCmdUI);
  80.     afx_msg void OnUpdateViewZoomIn(CCmdUI* pCmdUI);
  81.     afx_msg void OnUpdateViewZoomOut(CCmdUI* pCmdUI);
  82.     afx_msg void OnUpdateViewNegX(CCmdUI* pCmdUI);
  83.     afx_msg void OnUpdateViewPosX(CCmdUI* pCmdUI);
  84.     afx_msg void OnUpdateViewNegY(CCmdUI* pCmdUI);
  85.     afx_msg void OnUpdateViewPosY(CCmdUI* pCmdUI);
  86.     afx_msg void OnUpdateViewNegZ(CCmdUI* pCmdUI);
  87.     afx_msg void OnUpdateViewPosZ(CCmdUI* pCmdUI);
  88.     afx_msg void OnUpdateViewHigherVolumeSlice(CCmdUI* pCmdUI);
  89.     afx_msg void OnUpdateViewLowerVolumeSlice(CCmdUI* pCmdUI);
  90.     //}}AFX_MSG
  91.     DECLARE_MESSAGE_MAP()
  92.  
  93. private:
  94.     HRESULT UpdateDevice(VOID);
  95.     HRESULT RenderScene(VOID);
  96.     CDxtexApp* PDxtexApp(VOID) { return (CDxtexApp*)AfxGetApp(); }
  97.     HRESULT BuildViewSurface(BOOL bOrig, D3DCUBEMAP_FACES FaceType, LONG lwSlice, LONG lwMip, BOOL bViewAlpha);
  98.     HRESULT LoadSurfaceFromVolumeSlice(LPDIRECT3DVOLUME9 pVolume, UINT iSlice, LPDIRECT3DSURFACE9 psurf);
  99.  
  100.     DWORD NumBytesInSurfaces(D3DCUBEMAP_FACES FaceType, LPDIRECT3DBASETEXTURE9 ptex);
  101.     HRESULT CreateVertexBuffer(VOID);
  102.     CString FormatName(D3DFORMAT fmt);
  103.  
  104.     LPDIRECT3DVERTEXBUFFER9 m_pVB;
  105.     LPDIRECT3DTEXTURE9 m_ptexCur; // Currently-viewed texture surface
  106.     LPDIRECT3DSWAPCHAIN9 m_pSwapChain;
  107.     CRect m_rcSrc; // Size of m_pddsCur and m_pddsBack
  108.     CRect m_rcDest; // m_rcDest scaled by m_fZoom
  109.     FLOAT m_fZoom; // Zoom factor
  110.     BOOL m_bViewOrig; // View "original" vs. "new" surface
  111.     BOOL m_bViewAlpha; // View alpha channel alone vs. normal image
  112.     BOOL m_bTitleModsChanged; // Whether title bar text modifiers need to be updated
  113.     LONG m_lwMipCur; // Currently-viewed mip.  0 = top, 1 = next one down, etc.
  114.     D3DCUBEMAP_FACES m_CubeFaceCur; // D3DCUBEMAP_FACE_FORCE_DWORD = no cube map, or D3DCUBEMAP_FACE_POSITIVE_X, etc.
  115.     LONG m_lwSliceCur; // For volume maps
  116.     DWORD m_dwClearColor; // Background color that will show through where alpha is non-opaque
  117. };
  118.  
  119. #ifndef _DEBUG  // debug version in dxtexView.cpp
  120. inline CDxtexDoc* CDxtexView::GetDocument()
  121.    { return (CDxtexDoc*)m_pDocument; }
  122. #endif
  123.  
  124. /////////////////////////////////////////////////////////////////////////////
  125.  
  126. //{{AFX_INSERT_LOCATION}}
  127. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  128.  
  129. #endif // !defined(AFX_DXTXVIEW_H__712C53D1_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_)
  130.